import { NgModule } from '@angular/core'
import { Routes, RouterModule } from '@angular/router'

import { TradesListComponent } from './list/list.component'
import { TradesStatisticsComponent } from './statistics/statistics.component'
import { TradesOnlineChargeComponent } from './charge/list/online-charge.component'
import { TradesDetailComponent } from './detail/detail.component'
import { TradeChargeNewComponent } from './charge/new/new.component'
import { NewRouterGuardClass } from '@shared/classes/NewRouterGuardClass'
import { TradeChargeDetailComponent } from './charge/detail/charge-detail.component'
import { TradesRefundComponent } from './refund/refund.component'
import { TradesDetailECComponent } from './detail-ec/detail.component'
import { ListReuseGuardClass } from '@shared/classes/ListReuseGuardClass'
import { TradesBatchPresentComponent } from './batch-present/present.component'
import { TradesBatchPresentListComponent } from './batch-present-list/present.component'
import { TradesPresentComponent } from './present/present.component'
const routes: Routes = [
  { path: '', redirectTo: 'list', pathMatch: 'full' },
  {
    path: 'list',
    component: TradesListComponent,
    canActivate: [ListReuseGuardClass],
    pathMatch: 'full',
    data: {
      title: '交易列表',
      titleI18n: 'MENU.TRADE.LIST',
      reuse: true,
    },
  },
  { path: 'statistics', redirectTo: 'statistics/list', pathMatch: 'full' },
  {
    path: 'statistics/list',
    component: TradesStatisticsComponent,
    pathMatch: 'full',
    canActivate: [ListReuseGuardClass],
    data: {
      title: '交易统计',
      titleI18n: 'MENU.TRADE.STATISTICS',
      reuse: true,
    },
  },
  {
    path: 'charge',
    redirectTo: 'charge/list',
    component: TradesOnlineChargeComponent,
    pathMatch: 'full',
  },
  {
    path: 'charge/list',
    component: TradesOnlineChargeComponent,
    pathMatch: 'full',
    canActivate: [ListReuseGuardClass],
    data: {
      title: '在线收款',
      titleI18n: 'MENU.TRADE.CHARGE',
      reuse: true,
    },
  },
  {
    path: 'charge/new',
    component: TradeChargeNewComponent,
    canDeactivate: [NewRouterGuardClass],
    data: {
      breadcrumb: 'GENERAL.INFO.BREADCRUMB.CREATE',
      title: '新建在线收款',
      titleI18n: 'TRADE.ONLINE_CHARGE.TITLE.CREATE',
    },
  },
  {
    path: 'charge/:id',
    component: TradeChargeDetailComponent,
    data: {
      breadcrumb: 'GENERAL.INFO.BREADCRUMB.DETAIL',
      titleI18n: 'TRADE.ONLINE_CHARGE.TITLE.DETAIL',
    },
  },
  {
    path: ':id',
    component: TradesDetailComponent,
    data: {
      breadcrumb: 'GENERAL.INFO.BREADCRUMB.DETAIL',
      title: '交易详情',
      titleI18n: 'TRADE.TITLE.DETAIL',
    },
  },
  {
    path: ':orderNum/:intStoreCode/ec',
    component: TradesDetailECComponent,
    data: {
      breadcrumb: 'GENERAL.INFO.BREADCRUMB.DETAIL',
      titleI18n: 'TRADE.TITLE.DETAIL',
    },
  },
  {
    path: ':orderNum/:intStoreCode/:category',
    component: TradesDetailComponent,
    data: {
      breadcrumb: 'GENERAL.INFO.BREADCRUMB.DETAIL',
      titleI18n: 'TRADE.TITLE.DETAIL',
    },
  },
  {
    path: ':orderNum/:intStoreCode/:category/refund',
    component: TradesRefundComponent,
    data: {
      refundType: 'merchantRefund',
      breadcrumb: 'TRADE.TITLE.MERCHANT_REFUND',
      title: '商户退款',
      titleI18n: 'TRADE.TITLE.MERCHANT_REFUND',
    },
  },
  {
    path: ':orderNum/:intStoreCode/:category/manualRefund',
    component: TradesRefundComponent,
    data: {
      refundType: 'manualRefund',
      breadcrumb: 'TRADE.TITLE.MANUAL_REFUND',
      title: '手工退款',
      titleI18n: 'TRADE.TITLE.MANUAL_REFUND',
    },
  },
  {
    path: ':orderNum/:intStoreCode/:category/manualPresent',
    component: TradesPresentComponent,
    data: {
      refundType: 'manualPresent',
      breadcrumb: 'TRADE.SETTLE.PRESENTMENT',
      title: '手工请款',
      titleI18n: 'TRADE.SETTLE.PRESENTMENT',
    },
  },
  {
    path: ':orderNum/:intStoreCode/:category/manualPresent/batchPresent/:batchNum/:terminalid',
    component: TradesBatchPresentListComponent,
    data: {
      breadcrumb: 'TRADE.BATCH.PRESENTMENT',
      title: '批次请款',
      titleI18n: 'TRADE.BATCH.PRESENTMENT',
    },
  },
  {
    path: ':orderNum/:intStoreCode/:category/manualPresent/batchPresent/:batchNum/:terminalid/batchPresentDetail',
    component: TradesBatchPresentComponent,
    data: {
      breadcrumb: 'TRADE.BATCH.PRESENTMENT',
      title: '批次请款',
      titleI18n: 'TRADE.BATCH.PRESENTMENT',
    },
  },

]

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class TradesRoutingModule {}
